<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>签到/签退</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<!--标准mui.css-->
		<link rel="stylesheet" href="../css/mui.min.css">
		<!--App自定义的css-->
		<!-- <link rel="stylesheet" type="text/css" href="../css/app.css" /> -->
		<style>
			html,body {
				background-color: #efeff4;
			}
			.title{
				margin: 20px 15px 10px;
				color: #6d6d72;
				font-size: 15px;
			}
			 .oa-contact-cell.mui-table .mui-table-cell {
				padding: 11px 0;
				vertical-align: middle;
			}
			
			.oa-contact-cell {
				position: relative;
				margin: -11px 0;
			}
			
			.oa-contact-avatar {
				width: 75px;
			}
			.oa-contact-content {
				width: 100%;
			}
			.oa-contact-name {
				margin-right: 20px;
			}
			.oa-contact-name, oa-contact-position {
				float: left;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">签到/签退</h1>
		</header>
		<div class="mui-content">
			<ul id="stampUl" class="mui-table-view mui-table-view-striped mui-table-view-condensed"></ul>
		</div>
		<script type="text/javascript" src="../js/jquery1113.js"></script>
		<script src="../js/mui.min.js"></script>
		<script src="../js/util.js"></script>
		<script src="../js/data.js"></script>
		<script>
			var classId,className;
			mui.init({
				swipeBack: true //启用右滑关闭功能
			});
			mui.plusReady(function() {
				self = plus.webview.currentWebview();
				classId = self.classId;
				className = self.className;
				$(".mui-title").html(className+"签到列表")
				getStampList();
			});
			function getStampList(){
				var name = plus.storage.getItem('name');
				var password = plus.storage.getItem('password');
				if(name != null && name != '' && password != null && password != '' && classId != null && classId != ''){
					
					var jsonObject = {};
					jsonObject['name'] = name;
					jsonObject['password'] = password;
					jsonObject['classId'] = classId;
					
					xhr = new plus.net.XMLHttpRequest();
					xhr.onreadystatechange = function() {
						if(xhr.readyState == 4 && xhr.status == 200){
							var data = JSON.parse(xhr.responseText);
							if (data && data.result == 1 && data.data) {
								var appendStr = "";
								$.each(data.data,function(index,item){
									if(item){
										appendStr += '<li class="mui-table-view-cell">'+
										'<div class="mui-slider-cell" onclick="getMySignIn(\''+item.dateName+'\',\''+item.id+'\')">'+
										'<div class="oa-contact-cell mui-table">'+
										'<div class="oa-contact-avatar mui-table-cell">'+
										'<img style="width:60px;height:60px;" src="../images/stamp.png" />'+
										'</div>'+
										'<div class="oa-contact-content mui-table-cell">'+
										'<div class="mui-clearfix">'+
										'<h4 class="oa-contact-name">'+data.username+'</h4>'+
										'<span class="oa-contact-position mui-h6">点击查看</span>'+
										'</div>'+
										'<p class="oa-contact-email mui-h6">'+
										item.dateName+
										'</p>'+
										'</div>'+
										'</div>'+
										'</div>'+
										'</li>';
									}
								});
								$("#stampUl").html(appendStr);
							} else {
								mui.alert(data.message);
							}
						}
					}
					xhr.open("POST", serverUrl + "teachClass/PubGetMyStampListByClassId.do");
					xhr.setRequestHeader("Content-Type", "application/json");
					xhr.send(JSON.stringify(jsonObject));
				}
			}
			function getMySignIn(stampName,stampId){
				plus.webview.create('mySignIn.html', "mySignIn",{},{'className':className,'classId':classId,'stampName':stampName,'stampId':stampId}).show();
			}
		</script>
	</body>

</html>